package com.example.lib_patrol.add

import com.example.lib_common.mvi.BaseRepository
import com.example.lib_common.mvi.ResponseEntity
import com.example.lib_patrol.ApiService
import com.example.lib_patrol.PatrolEntity
import com.example.network_sdk.HttpType
import com.example.network_sdk.NetWorkFactory
import kotlinx.coroutines.flow.Flow

class AddPatrolRepository : BaseRepository() {
    fun requestAllRepairPoint() : Flow<ResponseEntity<List<PointEntity>>> {
        return NetWorkFactory.factory(HttpType.TOKEN)!!
            .create(ApiService::class.java)
            .requestAllPatrolPoint()
    }

    fun requestAddPatrols(map: HashMap<String,Any>) : Flow<ResponseEntity<PointEntity>> {
        return NetWorkFactory.factory(HttpType.TOKEN)!!
            .create(ApiService::class.java)
            .requestAddPatrols(createBody(map))
    }

    fun requestAllGroup() : Flow<ResponseEntity<List<GroupEntity>>> {
        return NetWorkFactory.factory(HttpType.TOKEN)!!
            .create(ApiService::class.java)
            .requestAllGroup()
    }
}